AttrDXL and Layout Calculation

Its my understanding that Attr DXL and Layouts are calculated as described here.

In both cases the value calculated exists on the local Client, is not stored in the DB in anyway, and is lost when you close the module. Since its not stored you can see these values in Read mode, even though AttrDXL appears to be 'setting' the value.

Layouts:

The code for a Layout to calculate the object value for display is performed each time DOORS requests that value for display. If the default view has a layout and shows the first5 5 objects, then the code is calculated once for each such object. If you scroll down to see 5 more objects its calcualted 5 more times.

However, the key here is "each time DOORS requests that value for display". If you move some other window over the Module window, DOORS requests the value for display frequently, which I estimiated to be 10 times per second. So if you are viewing 5 objects and use the mouse to move some other windows over the Module window, you may get a whopping 50 re-calculations per second. I think you get a similar effect when you move the mouse over the module window or when you move the module window over other windows. This fact makes Layout rather hopeless for all but the simplest calculations.

Layouts drain computer resources drastically.

I proved this to Telelogic where the layout issued a print statement and the time of day in seconds, and they had no idea it was this often but I believe did nothing about it.

AttrDXL:

The code for an AttrDXL to calculate the object value is performed when the value is requested and the current value is not null. When you first open a module all the values are null and if the AttrDXL is in the view when you open it, you get that many calculations. When you scroll you again get recalculations. Moving other windows around, however, does not calculate the DXL but rather just takes the existing value, if that value isn't null.

Unlike Layouts, however, if you scroll up there is no need for recalculation.

Now lets suppose your AttrDXL displays information about linked objects, which means for many objects the desired value is null because they have no links. If null is displayed for that object value then it will be re-calculated as often as a layout. But if by convention you set a null value to be perhaps a space, then its not re-calculated so often. The end of you AttrDXL then could reasonably look like this:

.. string Results = the calculation
.. if (null Results) //
.. then obj.attrDXLName = " "
.. else obj.attrDXLName = Results

If you go that route then other DXL that reads the values will want to check for a null retrieved value, as well as a single-space returned value.

You can "get" an attrDXL value for an object by displaying it in the view, by using other DXL to request its value, or by opening the Object Properties dialog which displays that object's attr-values.

If you get the value and then change the data it uses to calculate (e.g. add a link), the attrDXL does not change value. To get it to change value you must either close the module and re-open it, or set its value to null and then request it again. That's what the "Refresh DXL Attributes" function does, it just sets the values to null, something like this:

.. for obj in module do
.. { obj."NameAttrDXL" = ""
.. }

After refreshing, the value will be recalcuated upon request and you will see the new information.

  • Louie

llandale - Mon Sep 26 12:32:46 EDT 2011

Re: AttrDXL and Layout Calculation
Peter_Albert - Tue Sep 27 05:45:26 EDT 2011

I agree to almost all points, but for one point I observe a different behaviour:

> When you first open a module all the values are null and if the AttrDXL is in the view when you open it, you get that many calculations. When you scroll you again get recalculations.
I am seeing that the attribute DXL is calculated only once, and this is when the object becomes visible for the first time. If the view starts with displaying only one object, then the attribute DXL fires only for this object. When you scroll down, it fires for each object as it becomes visible. There is never a recalculation just by scrolling down. It is either the first calculation, or nothing.

Regards,

Peter

Re: AttrDXL and Layout Calculation
Mathias Mamsch - Tue Sep 27 10:17:37 EDT 2011

Attribute DXL behaves even more complex it seems. When you set a filter, then only the visible objects are recalculated. Even if your default view has a filter this still applies (so NOT all objects are calculated). If you do NOT have a column displayed and open the module, then just a random selection of objects are calculated it seems. If I then press F5 then nothing happens. If I then display the objects, then objects that have a null value will recalculate like a DXL layout: All visible objects that have a null value will recalculate on every mouse click. All other objects that have a value, will only calculate once at the beginning of displaying the column, then not. Pressing F5 will only recalculate the displayed objects.

Now comes the weirdness. You can change the value of a DXL attribute from other code: (current Object)."DX" = "Test". The object will keep its value and if it had a null value, recalculation stops if you assigned a value. When you press F5 then these object loose their value, regardless if they are displayed or not. That means, even if they are not recalculated, they will loose their value.

It just seems like a mess to me ;-) Fortunately it seems not to be a NO-GO to assign null values in attribute DXL, you will just end up with something like a layout DXL for those objects.

I tested with a module with 13 empty objects (headings) and a dxl attribute "DXL" with the following code:
 

print "-->" (number obj) "\n"
if      (number obj == "2") obj.attrDXLName = (charOf 0) ""
else if (number obj == "3") obj.attrDXLName = ""
else if (number obj == "4") obj.attrDXLName = null
else obj.attrDXLName = "XXX"

 


Then I tried filters and different window sizes to make the objects be displayed in the current view.

Regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: AttrDXL and Layout Calculation
llandale - Tue Sep 27 14:26:57 EDT 2011

Mathias Mamsch - Tue Sep 27 10:17:37 EDT 2011

Attribute DXL behaves even more complex it seems. When you set a filter, then only the visible objects are recalculated. Even if your default view has a filter this still applies (so NOT all objects are calculated). If you do NOT have a column displayed and open the module, then just a random selection of objects are calculated it seems. If I then press F5 then nothing happens. If I then display the objects, then objects that have a null value will recalculate like a DXL layout: All visible objects that have a null value will recalculate on every mouse click. All other objects that have a value, will only calculate once at the beginning of displaying the column, then not. Pressing F5 will only recalculate the displayed objects.

Now comes the weirdness. You can change the value of a DXL attribute from other code: (current Object)."DX" = "Test". The object will keep its value and if it had a null value, recalculation stops if you assigned a value. When you press F5 then these object loose their value, regardless if they are displayed or not. That means, even if they are not recalculated, they will loose their value.

It just seems like a mess to me ;-) Fortunately it seems not to be a NO-GO to assign null values in attribute DXL, you will just end up with something like a layout DXL for those objects.

I tested with a module with 13 empty objects (headings) and a dxl attribute "DXL" with the following code:
 

print "-->" (number obj) "\n"
if      (number obj == "2") obj.attrDXLName = (charOf 0) ""
else if (number obj == "3") obj.attrDXLName = ""
else if (number obj == "4") obj.attrDXLName = null
else obj.attrDXLName = "XXX"

 


Then I tried filters and different window sizes to make the objects be displayed in the current view.

Regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Played with your code, and it seems that if any of the displayed object's have a null value, then all displayed objects are re-calculated on module refresh, for that DXL attribute, and that re-calculation seems to be at refresh rate and seems similar to Layouts. That's another reason not to calculate and assign a null value.

Not following your wierdness paragraph. How do you now its lost its assigned value if its not displayed? I modified your code such that when calculating "4.1" it would ack a message. Then wrote an on-demand script to find "4.1" and assign it a specific value. Made sure 4.1 is not in the current view. After assigning a value, F5 refresh did not trigger firing its recalculation.

  • Louie

Re: AttrDXL and Layout Calculation
Mathias Mamsch - Tue Sep 27 17:40:08 EDT 2011

llandale - Tue Sep 27 14:26:57 EDT 2011
Played with your code, and it seems that if any of the displayed object's have a null value, then all displayed objects are re-calculated on module refresh, for that DXL attribute, and that re-calculation seems to be at refresh rate and seems similar to Layouts. That's another reason not to calculate and assign a null value.

Not following your wierdness paragraph. How do you now its lost its assigned value if its not displayed? I modified your code such that when calculating "4.1" it would ack a message. Then wrote an on-demand script to find "4.1" and assign it a specific value. Made sure 4.1 is not in the current view. After assigning a value, F5 refresh did not trigger firing its recalculation.

  • Louie

I think on a refresh the visible objects are always recalculated, regardless if they have a null value or not. Why do you think it is a bad thing that null values keep refreshing like a DXL layout? I could not observe any endless loops or crashes when null values are assigned in DXL attributes. Instead I just observerd the DXL Layout like behaviour. I do not get why that should be a reason not to use null value in any case. For reasonable fast calculations a null value makes perfect sense. The only reason I would see to explicitly set a space instead of null would be that you arrive at the null value after a very complex calculation, which you do not want to do over and over again. Otherwise applying that logic all DXL layout should be abandoned too.

Regarding the weirdness stuff: What I did is, I had objects 2,3,4 with their null values some value assigned, but explicitly setting it through Edit / DXL / (current Object)."DX" = "Val" ... What I observed then is that the DXL Layout like behaviour ended. I also could scroll away and scroll back and the objects kept their value. I pressed F5 for refresh. The objects were recalculated and lost their values. That was logical. Not I assigned the values to them again, scrolled them out of the view and pressed again F5. Now the objects were NOT recalculated (no print statement for them), but they still lost the value I assigned to them. That was not logical anymore.

Regards, Mathias

Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: AttrDXL and Layout Calculation
llandale - Tue Sep 27 17:55:11 EDT 2011

Mathias Mamsch - Tue Sep 27 17:40:08 EDT 2011
I think on a refresh the visible objects are always recalculated, regardless if they have a null value or not. Why do you think it is a bad thing that null values keep refreshing like a DXL layout? I could not observe any endless loops or crashes when null values are assigned in DXL attributes. Instead I just observerd the DXL Layout like behaviour. I do not get why that should be a reason not to use null value in any case. For reasonable fast calculations a null value makes perfect sense. The only reason I would see to explicitly set a space instead of null would be that you arrive at the null value after a very complex calculation, which you do not want to do over and over again. Otherwise applying that logic all DXL layout should be abandoned too.

Regarding the weirdness stuff: What I did is, I had objects 2,3,4 with their null values some value assigned, but explicitly setting it through Edit / DXL / (current Object)."DX" = "Val" ... What I observed then is that the DXL Layout like behaviour ended. I also could scroll away and scroll back and the objects kept their value. I pressed F5 for refresh. The objects were recalculated and lost their values. That was logical. Not I assigned the values to them again, scrolled them out of the view and pressed again F5. Now the objects were NOT recalculated (no print statement for them), but they still lost the value I assigned to them. That was not logical anymore.

Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Layouts re-calculate rediculously often. If its a complicated calculation like following a link then it drastically bogs down DOORS. It recalculates whenever the module window is refreshed, which seems to be about 10 times a second when you are moving it or moving some other window over it. My partners had modules locked up for 4 hours because some clown wrote such layouts.

That's a lot of calculations and yes, that seems a reason to rarely use Layouts. Other reasons are its too easy to delete them and its rather difficult to query their values with DXL, something surely you want to do if its important. If you are going to count the number of Histories since baseline you should use an Attr-DXL, since surely some report will want that info. Layout usefulness drops off drastically if they are niether simple nor unimportant.

In the Attr-DXL case, we see that having one object displayed with a null value will force re-calculation of all the objects that are displayed (for that attr-DXL), thus turning the whole thing into a Layout.

Will check out the odd case where an Attr-DXL is set externally, but that doesn't seem too common a thing to worry about.

  • Louie